#ifndef PROGRAM_DATASTRUCT_BINARY_TREE_H_
#define PROGRAM_DATASTRUCT_BINARY_TREE_H_

namespace binarytree{

#define DEFAULT_TREE_CAP 10

class BinaryNode
{
public:
    BinaryNode();
    BinaryNode(int d);
public:
    void SetData(int d);
    void SetLeft(BinaryNode* l);
    void SetRight(BinaryNode* r);

    int GetData();
    BinaryNode* GetLeft();
    BinaryNode* GetRight();
public:
    void TreeInsert(int d);
private:
    int m_data;
    BinaryNode* m_left;
    BinaryNode* m_right;
};

class BinaryTree
{
public:
    BinaryTree(int cap);
    ~BinaryTree();
public:
    void TreeInsert(int d);

    void Preorder();
    void Inorder();
    void Postorder();
    void Levelorder();
private:
    void preorderhelper(BinaryNode* node);
    void inorderhelper(BinaryNode* node);
    void postorderhelper(BinaryNode* node);
private:
    BinaryNode* m_root;
    BinaryNode* m_content;
    int m_cap;
    int m_size;
};

}
#endif // PROGRAM_DATASTRUCT_BINARY_TREE_H_
